
<%@include file="/WebPages/Includes/header.jsp"%>
<%@include file="/WebPages/Includes/startBody.jsp"%>
<%@include file="/WebPages/Includes/tablesorter.jsp"%>
<%@include file="/WebPages/Includes/navbar.jsp"%>
<%@include file="/WebPages/Includes/startMainContent.jsp"%>
<%@include file="/WebPages/Includes/leftSidebar.jsp"%>
 	
<div class="col-lg-8 col-md-8 col-xs-12 col-sm-9">
	<hr>

	<button class="btn btn-primary btn-sm insertUser " data-target="#myInsertModal"
		data-toggle="modal">Create User</button>

	<button class="btn btn-danger btn-sm  deleteUser" data-target="#myConfirmModal"
		data-toggle="modal" id="deleteSelectedRows" onclick="deleteMultipleUserJs();">Delete Selected</button>

	<hr>
	<div id="loading" ></div>

	<div class="table-responsive"
		style="overflow-x: auto; overflow-y: auto;" id="tableDiv">
		 </div>

	<!-- Insert Modal -->
	<div aria-hidden="true" aria-labelledby="myInsertModalLabel"
		class="modal fade" id="myInsertModal" role="dialog" tabindex="-1">
		<div class="modal-dialog">
			<div class="modal-content">
				<div class="modal-header">
					<button aria-hidden="true" class="close" data-dismiss="modal"
						type="button">&times;</button>
					<h4 class="modal-title" id="myInsertModalLabel">Create User</h4>
				</div>
				<div class="modal-body">
					<form id="addUserForm" method="post">
						 
						<div class="form-group">
							<label class="control-label" for="email">E-Mail</label>
							<input class="form-control" id="email"
								name="email" placeholder="E-Mail"  type="text" />
						</div>
						
						<div class="form-group">
							<label class="control-label" for="description">Group Name
								 </label> 
									<select class="form-control"  id="customGroups" name="customGroups">
							</select>
						</div>
 
						<button class="btn btn-primary" id="request"
							onclick="insertUser();" type="button">Add User</button>
					</form>
				</div>
			</div>
		</div>
	</div>


	<!-- Update Modal -->
	<div aria-hidden="true" aria-labelledby="myModalLabel"
		class="modal fade" id="myUpdateModal" role="dialog" tabindex="-1">
		<div class="modal-dialog">
			<div class="modal-content">
				<div class="modal-header">
					<button aria-hidden="true" class="close" data-dismiss="modal"
						type="button">&times;</button>
					<h4 class="modal-title" id="myModalLabel">Update User	</h4>
				</div>
				<div class="modal-body">

					<form id="updateForm" method="post">
					<div class="form-group">
							<label class="control-label" for="description">Name
								 </label> 
								 <input disabled
								class="form-control" id="uName" name="uName"
								placeholder="Name" type="text" />
						</div>
						<div class="form-group">
							<label class="control-label" for="uemail">Email</label> <input disabled
								class="form-control" id="uemail" name="uemail"
								placeholder="Group Name" type="text" />
						</div>
						<div class="form-group">
							<label class="control-label" for="description">Group Name
								 </label> 
									<select class="form-control"  id="uGroupCode" name="uGroupCode">
							</select>
						</div>
						
						<input type="hidden" id="ucode" name="ucode" />
<!-- <input   id="ucode" value="hj" name="ucode"  type="hidden" /> -->
			 
						<button class="btn btn-primary" id="update"
							onclick="updateUser();" type="button">Update</button>
					</form>
				</div>
			</div>
		</div>
	</div>


	<!-- Confirm Modal -->
	<div aria-hidden="true" aria-labelledby="myConfirmModalLabel"
		class="modal fade" id="myConfirmModal" role="dialog" tabindex="-1">
		<div class="modal-dialog">
			<div align="center" class="modal-content">
				<div class="modal-header">
					<h4 class="modal-title" id="myConfirmModalLabel">Are you sure?</h4>
				</div>
				<div class="modal-body">
					<button class="btn btn-danger" id="confirmDelete" type="submit">Yes</button>
					<button class="btn btn-primary" id="cancelDelete" type="submit">No</button>
				</div>
			</div>
		</div>
	</div>

	<!-- Error modal -->
	<div class="modal fade bs-example-modal-sm" id="myErrorModal"
		tabindex="-1" role="dialog" aria-labelledby="myErrorModalLabel"
		aria-hidden="true">
		<div class="modal-dialog modal-sm">
			<div class="modal-content" align="center">
				<div class="modal-header">
					<h4 class="modal-title" id="myErrorModalLabel">Error</h4>
				</div>
				<div class="modal-body">
					<div id="ErrorContent"></div>
					<hr />
					<button class="btn btn-primary" id="errorOk" type="submit">Ok</button>
				</div>
			</div>
		</div>
	</div>
</div>

<%@include file="/WebPages/Includes/rightSidebar.jsp"%>
<%@include file="/WebPages/Includes/endMainContent.jsp"%>
<%@include file="/WebPages/Includes/footer.jsp"%>

<!-- custom scripts here -->
<script src="./../../customJS/Identity/IdentityUser.js"></script>
<%@ page import="com.easyskool.utilfunction.UtilFunctions" %>
<%@ page import="com.easyskool.constants.CommonConstants" %>
<%@ page import="java.util.HashMap" %>
<%@ page import="com.easyskool.hibernate.model.Schools" %>


<%
	HashMap<String, Integer> sections=new  HashMap<String, Integer>();
//insertUser
//deleteUser
//UpdateUser
//GetUser
sections.put("insertUser", 0);
sections.put("deleteUser", 0);
sections.put("updateUser", 0);
sections.put("getUser", 0);


UtilFunctions.getAllowedsubGroups(sections,(String)session.getAttribute(CommonConstants.ACCESS_GROUPS),(Schools)session.getAttribute(CommonConstants.SCHOOL_CODE));


out.println(sections.get("insertUser"));
out.println(sections.get("deleteUser"));
out.println(sections.get("updateUser"));
out.println(sections.get("getUser"));
// hideElements('updateUser',updateWhat);
// hideElements('insertUser',insertWhat);
// hideElements('deleteUser',deleteWhat);
out.println("<script>");
// String what="
	if (sections.get("insertUser") == 1)
		out.println("var insertWhat='false'; ");
	else
		out.println("var insertWhat='true'; ");
	if (sections.get("updateUser") == 1)
		out.println("var updateWhat='false'; ");
	else
		out.println("var updateWhat='true'; ");
	if (sections.get("deleteUser") == 1)
		out.println("var deleteWhat='false'; ");
	else
		out.println("var deleteWhat	='true'; ");

	out.println("</script>");
%>
<%@include file="/WebPages/Includes/endBody.jsp"%>